package com.ship.dispatch.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ship.common.datasource.annotation.Slave;
import com.ship.dispatch.bean.treaShipNetwork.IhsShipBaseDetails;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SpInfoDetailsMapper extends BaseMapper<IhsShipBaseDetails> {

    /**
     * 查询详情信息
     * @return
     */
    @Select("SELECT * FROM ihs_ship_base ORDER BY ship_name")
    @Slave
    List<IhsShipBaseDetails> getInfo();

    /**
     * 根据id查询详情信息
     * @param ids
     * @return
     */
    @Select({
            "<script>",
            "SELECT * ",
            "FROM ihs_ship_base ",
            "WHERE imo IN ",
            "<foreach item='item' index='index' collection='arg0' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "ORDER BY ship_name",
            "</script>"
    })
    @Slave
    List<IhsShipBaseDetails> getInFOById(List<String> ids);

    /**
     * 查询船舶信息当前自定义列
     * @return
     */
    @Select("SELECT column_key FROM table_config where `module` = 'ihs_ship_base_list'")
    List<String> getTableInfo();
}
